Code sample Home

Create multilines

HANDLE hLtype, hMStyle, hBlock, hMline;
// create new linetype
hLtype = lcDrwAddLinetype( m_hLcDrw, L"Dashed", L"2,-2" );
// create new multiline style
hMStyle = lcDrwAddMlineStyle( m_hLcDrw, L"Mline 2" );
lcPropPutInt( hMStyle, LC_PROP_MLSTYLE_ILINE, 0 );
lcPropPutFloat( hMStyle, LC_PROP_MLSTYLE_OFFSET, -3 );
lcPropPutInt( hMStyle, LC_PROP_MLSTYLE_ILINE, 1 );
lcPropPutFloat( hMStyle, LC_PROP_MLSTYLE_OFFSET, 3 );
lcPropPutStr( hMStyle, LC_PROP_MLSTYLE_COLOR, L"blue" );
lcMLStyleAddLine( hMStyle, -1, L"red", hLtype );
lcMLStyleAddLine( hMStyle, 1, L"green", hLtype );
lcMLStyleSortLines( hMStyle );
lcPropPutBool( hMStyle, LC_PROP_MLSTYLE_STARTLINE, true );
lcPropPutBool( hMStyle, LC_PROP_MLSTYLE_ENDLINE, true );
// select current multiline style
lcPropPutHandle( m_hLcDrw, LC_PROP_DRW_MLSTYLE, hMStyle );
// get model block
hBlock = lcPropGetHandle( m_hLcDrw, LC_PROP_DRW_BLOCK_MODEL );
// add multiline
hMline = lcBlockAddMline( hBlock, 0, false );
lcMlineAddVer( hMline, 0, 10,10 );
lcMlineAddVerDir( hMline, 0, 45*LC_DEG_TO_RAD, 30 );
lcMlineAddVerDir( hMline, 0, -45*LC_DEG_TO_RAD, 30 );
lcMlineAddVerDir( hMline, 0, 0, 30 );
// update view
lcDrwRegenViews( m_hLcDrw, hMline );
lcWndExeCommand( m_hLcWnd, LC_CMD_ZOOM_EXT, 0 );

This will create a drawing as shown on the picture below: